package meijuli.com.join51.business.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import meijuli.com.join51.business.fragment.MyQRFragment;
import com.jhx.common.model.User;
import com.jhx.common.utils.UserManager;

/**
 * 二维码！
 *
 * @author wenqin 2017-05-12 10:20
 */

public class QrActivity extends BaseFragmentActivity{

    private User mUser;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setToolBarTitle("我的推广码");
        mUser = UserManager.get().getUser();
        if (UserManager.get().checkUserNull(this)) {
            return;
        }
        final MyQRFragment myQRFragment = MyQRFragment.newInstance();
        addFragment(myQRFragment);
        setRightText("分享", new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareQR(myQRFragment.getCodeUrl());
            }
        });
    }

    private void shareQR(String codeUrl) {
//        UMWeb umWeb = ShareUtils.getUMWeb(this, codeUrl, mUser.getHeadImage(),
//                mUser.getBusinessName() + "正在使用聚惠侠商家，邀您注册一起赚钱！",
//                codeUrl);
//        ShareUtils.showShareDialog(this, umWeb);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        //UMShareAPI.get(this).onActivityResult(requestCode, resultCode, data);
    }
}
